import './App.scss'
import { Router, Route, Switch, Redirect } from 'react-router-dom'
import Layout from './pages/Layout'
import Login from './pages/Login'
import Edit from '@/pages/Profile/Edit'
import PrivateRoute from './components/PrivateRoute'
import history from '@/utils/history'
import Chat from '@/pages/Profile/Chat'
import Article from '@/pages/Article'
import Search from '@/pages/Search'
import Result from '@/pages/Search/Result'
function App() {
  return (
    <Router history={history}>
      <div className="app">
        <Switch>
          {/* <Route exact path="/" render={() => <Redirect to="/home" />} /> */}
          <Redirect from="/" to="/home" exact></Redirect>
          <Route path="/home">
            <Layout></Layout>
          </Route>
          <Route path="/login">
            <Login></Login>
          </Route>
          <PrivateRoute path="/profile/edit">
            <Edit></Edit>
          </PrivateRoute>
          <Route path="/chat">
            <Chat></Chat>
          </Route>
          <Route path="/article/:id">
            <Article></Article>
          </Route>
          <Route exact path="/search">
            <Search></Search>
          </Route>
          <Route path="/search/result">
            <Result></Result>
          </Route>
        </Switch>
      </div>
    </Router>
  )
}

export default App
